package main

import (
	"context"
	"google.golang.org/grpc"
	"log"
)

func main() {
	// 连接到gRPC服务器
	conn, err := grpc.Dial("10.10.22.172:8001", grpc.WithInsecure())
	if err != nil {
		log.Fatalf("无法连接到服务器：%v", err)
	}
	defer conn.Close()

	// 创建gRPC客户端
	client := NewDrmSrvGrpcClient(conn)

	//准备gRPC请求
	req := &AdditionalDetailRequest{
		MemberId: 31,
		TaskId:   "1773541523894280192",
	}
	// 创建一个新的上下文，并设置 Authorization 元数据
	//ctx := metadata.AppendToOutgoingContext(context.Background(), "authorization", "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ4ZC1kZXNpZ24tc2VydmljZSIsImV4cCI6MTcxMTg3Mjk2OCwiaWF0IjoxNzExNjEzNzY4LCJpc3MiOiJ4ZC1taWRqb3VybmV5LXNlcnZlciIsIklEIjozMSwiVXNlcm5hbWUiOiIiLCJSb2xlSWRzIjpudWxsLCJQbGF0Rm9ybSI6MiwiTWVtYmVyU3RhdHVzIjo1fQ.rN2YQJdpWt0D9NfDb67MOQ00e4w09TWKoEhQ1Jeov28l6-j5yfp2N-VVhGCeGRqfTrK83Zdhppz28EY27yBEUd_jEs19n8Vv8Lzly0sjZILhcEiLypk5bm4HZt_Eqm8iac3FrwkOlqbpTT-c7y9uVKZ-PAppcaO7ZVH5zrHjGqI")

	// 发送gRPC请求
	resp, err := client.GetAdditionalDetail(context.Background(), req)
	if err != nil {
		log.Fatalf("调用GetUsedStorage失败：%v", err)
	}
	// 处理响应
	log.Printf("服务器响应：%d", resp.Code)
}
